import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/Index.vue'
import Nofind from '@/views/404'
import Login from '@/views/Login'
Vue.use(Router)
const router = new Router({
  mode: 'history',
  linkActiveClass: 'is-active',
  base: process.env.BASE_URL,
  routes: [
    { path: '*', name: '/404', component: Nofind },
    { path: '/login', name: 'login', component: Login },
    { path: '/', redirect: '/login' },
    {
      path: '/index',
      component: Index,
      children: [
      ]
    },
  ]
})
//router.beforeEach((to, from, next) => {
 //       const isLogin = localStorage.eleToken ? true : false;
  //      if (to.path == "/login" || to.path == "/register") {
 //         next();
  //      } else {
 //         isLogin ? next() : next("/login");
  //      }
  //    })


export default router;